package com.just.bz_back.controller.superr;

import com.just.bz_back.model.Type;
import com.just.bz_back.model.dto.JsonData;
import com.just.bz_back.service.TypeService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author : baibaiwucahng
 * @date : 2019/9/7  23:50
 */
@RestController
@RequestMapping("/api/v1/super/type")
public class SuperTypeController {

    @Resource
    private TypeService typeService;

    @RequestMapping(value = "/typeId",method = RequestMethod.POST)
    public JsonData getTypeByid(@RequestBody Type type)
    {
        return  JsonData.buildSuccess(typeService.getTypeByid(type));
    }

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public JsonData updateTypa(@RequestBody Type type)
    {
        return JsonData.buildSuccess(typeService.updateType(type));
    }

    @RequestMapping(value = "/insert",method = RequestMethod.POST)
    public JsonData insertType(@RequestBody  Type type)
    {
        return JsonData.buildSuccess(typeService.insertType(type));
    }
}
